package pl.cat;

public class DisplayJugEvent extends JugEvent {

	public int x, y;
	public int d;
	public int alpha;
	public int time;
	public boolean up = true;
	
	public DisplayJugEvent(JugEvent jugEvent, int x2, int y2){
		this.id = jugEvent.id;
		this.start = jugEvent.start;
		this.data = jugEvent.data;
		this.topic = jugEvent.topic;
		this.x = x2;
		this.y = y2;
		this.up=true;
		this.alpha=0;
		this.time=0;
		this.d=0;
	}
	
	public int changeAlpha()
	{
		if (up)
		{
			if (this.alpha<255)
				this.alpha++;
			else if (time<this.topic.length()*15)
				time++;
			else
				up=false;
		}
		else
		{
			if (this.alpha>0)
				this.alpha--;
		}
		
		return this.alpha;
	}
	
	public int topicPosX(){
		
		return this.x-this.d;
	}
	
	public int topicPosY(){
		
		return this.y;
	}
	
	public int datePosX(){
		if (this.data.length()>6)
			return this.x-(int)((float)this.d/0.6f);
		else
			return this.x-(int)((float)this.d/1.4f);
	}
	
	public int datePosY(){
		if (this.topic.length()>6)
			return this.y-10;
		else
			return this.y-15;
	}
	
	public int hourPosX(){
		
		return this.x+50-(int)((float)this.d*1.4f);
	}
	
	public int hourPosY(){
		
		return this.y+35;
	}
	

}
